home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / CNetDemo / cnet / sdk / include / mail.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-04  |  13.2 KB  |  363 lines

  1.  
  2. /* bitdefs for mail "flags" */
  3. #define MAIL_REALNAME    0x00000001
  4. #define MAIL_COPYSELF    0x00000002
  5. #define MAIL_LOWPRI        0x00000004
  6. #define MAIL_HIGHPRI        0x00000008
  7. #define MAIL_HOLD            0x00000010
  8. #define MAIL_CRASH        0x00000020
  9. #define MAIL_FSEND        0x00000040
  10. #define MAIL_FREQ            0x00000080
  11. #define MAIL_OPENED        0x00000100
  12. #define MAIL_REPLIED        0x00000200
  13. #define MAIL_RECEIPT        0x00000400
  14. #define MAIL_SIGNATURE    0x00000800
  15. #define MAIL_QUOTE        0x00001000
  16.  
  17. #define CNETOUTBOX        "mail:CNETOUTBOX"
  18. #define CNETINBOX            "mail:CNETINBOX"
  19.  
  20. // Error codes produced when mail-task cannot deliver mail - added 16-Aug-96
  21. // these codes decide what text is returned to the user who SENT the mail
  22. // explaining the reason that mail was "bounced"
  23. #define MAILERROR_NOUSER            0x01    // no user by this name
  24. #define MAILERROR_DISKFULL         0x02    // could not save data, disk full
  25. #define MAILERROR_LOWBALANCE        0x04    // receiving user has low balance
  26. #define MAILERROR_NORECIPIENT        0x08    // internal error.  MailToList structure
  27.                                                     // not included
  28. #define MAILERROR_NOMHEAD            0x10    // internal error.  No MailHeader4 specified
  29. #define MAILERROR_NOTEXT            0x20    // internal error.  No text in message
  30. #define MAILERROR_NOUUCP            0x40    // internal error.  No UUCP name specified for local mail
  31. #define MAILERROR_NODIR                0x80    // internal error.  Could not create user directory
  32. #define MAILERROR_NOINETSCRIPT    0x100    // internal error.  Could not create/spawn internet mail script
  33. #define MAILERROR_BADFIDOADDR        0x200    // bad/invalid fido address
  34. #define MAILERROR_LOWNETBALANCE    0x400    // recipient does not have enough Net Credits to receive mail
  35. #define MAILERROR_INVALIDMTYPE    0x800    // invalid MailType in struct MailToList
  36.  
  37. #define MAILERROR_BOXCLOSED      0x1000 // user's mailbox is closed!
  38. #define MAILERROR_FILTERBOUNCE    0x2000 // system wide mailkill on received mail
  39.  
  40. #define MAILERROR_NOSOCKETLIB        0x4000 // (bsd)socket.library could not be opened
  41.  
  42.  
  43. #ifndef CNET_MAIL
  44. #define CNET_MAIL
  45.  
  46.  
  47. // Fidonet - from nl.h
  48. struct Addr
  49.     {
  50.     UWORD Zone;
  51.     UWORD Net;
  52.     UWORD Node;
  53.     UWORD Point;
  54.     };
  55.  
  56. // Fidonet - from nl.h
  57. struct NodeDesc
  58.     {
  59.     struct Addr Node;                    // node address
  60.     ULONG Reserved0;
  61.  
  62.     UWORD Region;                        // region (0 if none)
  63.     UWORD Hub;                            // node # of this node's HUB (0 if none)
  64.     char *System;                        // node name
  65.     char *Sysop;                        // sysop name
  66.     char *Phone;                        // phone number
  67.     char *City;                         // city and state
  68.     char *Passwd;                        // password
  69.     char *Flags;                        // nodelist flags
  70.     LONG Cost;                            // cost
  71.     UWORD BaudRate;                    // baud rate
  72.     LONG ID;                             // unique ID (offset into nodeindex)
  73.  
  74.     ULONG Reserved1;                // New for version 5
  75.     ULONG Reserved2;                // For compatibility with nodelist.library
  76.     ULONG Reserved3;
  77.  
  78.     UBYTE Type;                     // Entry type
  79.     UBYTE Pad0;
  80.     };
  81.  
  82.  
  83. struct OldMailHeader {                // NEW 2.0 for mail, etc
  84.     struct    IsDate  Date;
  85.     struct    IsDate    EDate;        // for EXPIRATION setting
  86.     short    EDays;
  87.     char    Subject [81];                // Ahh, nice and roomy
  88.     char    From    [27];
  89.  
  90.     ULONG    Number;
  91.  
  92.     short    ByAccount;
  93.     long    ByID;
  94.  
  95.     char    To    [28];                        // originals, if was Sent/forwarded
  96.     long    ToID;
  97.     short    ToAccount;
  98.  
  99.     UBYTE    Receipt_NOT;                // obsolete (was return-receipt)
  100.     UBYTE    Return;                        // return original message??
  101.  
  102.     UBYTE    HasOriginal;                // if TRUE, this item contains the recipient's original message also
  103.     UBYTE    File;                            // for File Mail
  104.     UBYTE    Anonymous;                    // From an anonymous user?
  105.  
  106.     char    Route    [41];                    // for Bulk Mail, list of recips
  107.     short    Recipients;                    // number of recipients ...
  108.     UBYTE    Party;                        // Allow party responses?
  109.  
  110.     long    Length;
  111.     long    CheckSum;                    // must be 0
  112.  
  113.     long    Item;                            // if this message is repeated
  114.     long    Seek;                            // somewhere on the system    
  115.     short    Base;                            // this tells where !!!       
  116.  
  117.     char    NetAddress[52];            // may be shortened
  118.  
  119.     UBYTE    Alias;
  120.     UBYTE    Replied;
  121.     UBYTE    Received;
  122.     UBYTE    NoEdits;
  123.  
  124.     struct    IsDate  ShowDate;
  125. };
  126.  
  127.  
  128. struct MailHeader4 {                // NEW 2.0 for mail, etc
  129.     LONG HeaderSeek;                // dynamic, set by MailRead() and CheckMail() - location of header in _mhead4
  130.     ULONG Date;                        // date mail SENT - time_t value
  131.     ULONG    EDate;                    // for EXPIRATION setting - expire DATE (time_t value)
  132.     short    EDays;                    // expire days
  133.     char    Subject [81];            // Ahh, nice and roomy
  134.     char    From    [27];            // FROM user - Handle/name
  135.  
  136.     ULONG    Number;                    // unique ID number (16 bit HEX time stamp)
  137.  
  138.     short    ByAccount;                // if a local user, account number
  139.     long    ByID;                        // ""        ""     IDNumber
  140.  
  141.     char    To    [200];                // originals, if was Sent/forwarded or multi/carbon
  142.     long    ToID;                        // ""     ""  IDNumber
  143.     short    ToAccount;                // To account number
  144.  
  145.     UBYTE    Receipt;                    // return-receipt ??
  146.     UBYTE    Return;                    // return original message??
  147.  
  148.     UBYTE    Anonymous;                // From an anonymous user??
  149.  
  150.     UBYTE    NoSAMCharge;            // v4.13c - do not alter SAM when this item is killed
  151.  
  152.     BOOL  mfattach;                // if set, "FileAttach" contains the name of a file
  153.                               // which contains a LIST of files that are
  154.                               // attached to this mail header/item.
  155.                               // otherwise "FileAttach" contains the path/filename
  156.                               // of the attached file.
  157.  
  158.     char    Expansion[126];        // future expansion
  159.     short    Recipients;                // number of recipients ...
  160.  
  161.     long    Length;                    // Length of MESSAGE body
  162.     long    CheckSum;                // must be 0
  163.  
  164.     long    Item;                        // if this message is repeated
  165.     long    Seek;                        // somewhere on the system    
  166.     char    UniqueBase[75];        // this tells where - Same as subboard GO keyword !!! 
  167.                                         // was 21 bytes long up to CNet v4.21
  168.  
  169.     // this is set by Mail-TASK on incoming mail
  170.     char    NetAddress[80];        // Net address of the user this mail is from if a network mail
  171.  
  172.     UBYTE    Alias;                    // did user use an alias??
  173.     UBYTE    Replied;                    // did user reply??
  174.     UBYTE    Received;                // did user receive/read it yet??
  175.     UBYTE    HasOriginal;            // user kept original message??
  176.     UBYTE    NoEdits;                    // mail not editable if TRUE
  177.  
  178.     ULONG ReadDate;                // Date message READ - same as "Date" unless read
  179.     char FileAttach[128];        // full path/filename of attached file
  180.     short set;                        // which charge schedule to use - Physical number - Use NumToChargeSet() to get a pointer of type (struct ChargeSet *) to the actual ChargeSet
  181.     ULONG flags;                    // Mail flags (See bitdefs at the top of mail.h)
  182.  
  183.     char magic[13];                // Usually "1234CNET56789" for a VALID/non-corrupt header
  184.                               // Mail recovery programs will search for and         
  185.                               // test this to validate a "recovered" header!
  186.                                         // CNet MailRead also tests for this to be correct.
  187.                               // Automatic recovery should be active in CNet AMIGA  
  188.                               // v4.13                                              
  189.                                         // don't forget to get the TEXT from _mtext4 as well!!
  190.  
  191.     LONG text;                        // Seek() value for text in _text4
  192.     UBYTE Killed;                    // TRUE if mail is marked for deletion - only used for moving mail to trashcan
  193.  
  194.     struct MailHeader4 *next;    // set internally - pointer to the next mail header in current folder
  195. };
  196.  
  197.  
  198. /* folder structure - use GotoMailFolder(UUCP_ID, FOLDER_NAME) to open a mail folder */
  199. struct NewMailFolder {
  200.     char OwnerID[10];                    // UUCP ID of owner
  201.     char path[128];                    // path to this folder (usually mail:users/UUCP_ID)
  202.     char Name[40];                        // name of mail folder (ie. INBOX, OUTBOX, etc,..
  203.     BPTR headerfh;                        // file handle used to access this folder's mail HEADER file
  204.     BPTR textfh;                        // file handle used to access this folder's mail TEXT
  205.     UBYTE temporary;                    // TRUE if folder was opened on the fly and must be freed after current use
  206.     
  207.     struct NewMailFolder *NextFolder;    /* next folder allocated */
  208. };
  209.  
  210.  
  211. struct MailAlias4 {
  212.     char Alias[24];                    // 0 - alias to be entered when sending mail
  213.     char Name[24];                        // 24 - user's handle/name on the destination system
  214.     char Address[80];                    // 48 - destination address - blank if destination is local system
  215.     UBYTE MailType;                    // 128 - not currently used
  216.     struct MailAlias4 *NextAlias;    // pointer to next mailalias
  217. };
  218.  
  219.  
  220.  
  221. // the MailToList structure is filled in and returned by CMailIsUUCP,
  222. // CMailIsFido, CMailIsLocal and CMailIsAlias functions           
  223.  
  224. // the first item written to outbox/#?.mtl is the name of the MailHeader4
  225. // header/message file terminate by 0x0A - then 1 or more instances of   
  226. // struct MailToList                                                     
  227. struct MailToList
  228. {
  229.     char Name[100];    // full network name/address of user
  230.     char UUCP[10];        // UUCP id if local user
  231.  
  232.     UBYTE MailType;   // type of mail - mailtask uses this to decide what
  233.                      //                user name to use on outgoing mail
  234.                      //                and which file-attach method to  
  235.                      //                use and also how to send the mail
  236.                      //                                                 
  237.                      //              - 0=LOCAL REALNAME, 1=local HANDLE,
  238.                      //                2=UUCP,           3=FIDO         
  239.                      //                4=LOCAL-ALIAS,    5=Handle from  
  240.                      //                                    FindAccount  
  241.                             //                6=FEEDBACK        7=NEWUSER      
  242.                             //                8="SYSOP"                        
  243.     struct MailToList *next;
  244. };
  245.  
  246.  
  247. struct CNetNodeDesc    // possible argument to IsFido()
  248.     {
  249.     char UserName[30];            // User name
  250.     ULONG Node[4];                    // node address
  251.     UWORD Region;                    // region (0 if none)
  252.     UWORD Hub;                        // node # of this node's HUB (0 if none)
  253.     char System[60];                // node name
  254.     char Sysop[60];                // sysop name
  255.     char Phone[30];                // phone number
  256.     char City[60];                   // city and state
  257.     char Flags[60];                // nodelist flags
  258.     LONG Cost;                        // cost
  259.     UWORD BaudRate;                // baud rate
  260.     UBYTE Type;                // Entry type
  261. };
  262.  
  263.  
  264.  
  265. /**************************************************************************
  266.  * structure used in mail:users/UUCP_ID/twitfilter
  267.  * mail from user(s) matching the fields within will not be saved
  268.  * and the mail will be bounced back to the originating user
  269.  * stating that the recipient is blocking his messages
  270.  **************************************************************************/
  271. struct MailFilter
  272.     {
  273.     char Name[100];                        // full name of user to filter - may be UUCP name, real name or handle
  274.     ULONG Node[4];                            // network address to filter
  275.     BYTE expansion[100];                    // future expansion
  276.     struct MailFilter *NextFilter;    // internal use only
  277.     };
  278.  
  279.  
  280. // defines for CNAddressType() - see cnetfuncs.h
  281. #define ADDRESSTYPE_FIDO     0x01
  282. #define ADDRESSTYPE_INTERNET 0x02
  283. #define ADDRESSTYPE_LOCAL    0x03
  284. #define ADDRESSTYPE_UNKNOWN  0x04
  285.  
  286. #define MAILFILTER_NAMEADDR      0
  287. #define MAILFILTER_SUBJECT       1
  288.  
  289.  
  290.  
  291. // For linked list of spooled mail files tracked by mail-task.
  292. // Spool only used when "MailSend: Use internal SMTP routines" selected in
  293. // Config/Options
  294. struct MailSpoolEntry
  295.     {
  296.     char filename[128];
  297.     struct MailSpoolEntry *next;
  298.     };
  299.  
  300.  
  301.  
  302. // IMPStruct used for Intercept Mail Processing duties
  303. struct IMPStruct
  304.     {
  305.     struct Node IMP_node;    // Exec Node for this instance of IMPStruct
  306.     char Name[128];            // name/pattern to trap - IMP_node.ln_Name points here
  307.     char ProcessName[128];    // script/executable/subboard GO arg used to process this name/pattern
  308.     char ProcessReply[128];    // for mailing-list gating of subboard posts/replies, reply-to this address
  309.  
  310.     ULONG dflag;                // detect flag bits
  311.                                     // 0 = detect apparent sender
  312.                                     // 1 = detect apparent recipient
  313.                                                     // 2 = uumail file (not yet implemented
  314.  
  315.     ULONG pflag;                // processing type flag bits.
  316.                                     // 0 = ignore
  317.                                     // 1 = by script
  318.                                     // 2 = mailing list gate
  319.     };
  320.  
  321. #define IMPTYPE_NORMAL            0L
  322. #define IMPTYPE_SCRIPT            (1L << 0)
  323. #define IMPTYPE_MAILLIST        (1L << 1)
  324.  
  325. #define IMPDETECT_SENDER        0L
  326. #define IMPDETECT_RECIPIENT    (1L << 0)
  327.  
  328.  
  329. struct MIMEContentType
  330.     {
  331.     char type[64];         // name of content (eg. application/octet-stream)
  332.  
  333.     char encoding[64]; // encoding type (eg. base64)
  334.  
  335.     UBYTE method;         // 0-255; how to handle attachment
  336.                              // current methods:   0=leave as email
  337.                              //                    1=add to user mailbox as CNet FILE-attachment
  338.                              //                    2=Save as VALIDATED file in base with GO KEY specified in ProcessArg1
  339.                              //                    3=Save as UNVALIDATED file in base with GO KEY specified in MethodArg1
  340.                              //                    4=save to >NIL: (eg. delete/lose it from the system)
  341.  
  342.     char methodarg[75]; // currently only functions as GO ARG for a subboard
  343.                               // for method types 2 or 3.
  344.  
  345.     char decode[128]; // command to decode attachment.  Any %n used in this command
  346.                         // will be replaced with the temp filename used for the
  347.                         // attachment.  Any %t in this command will be replaced
  348.                                 // with the DESTINATION (eg decoded) filename to be used
  349.                                 // for this attachment.  If there is no decode command
  350.                         // specified, the RAW attachment will be saved to the
  351.                         // location associated with the Method for this type
  352.                                 //
  353.                                 // substitutions:  %f = FROM (temp) filename
  354.                                 //                 %t = attachment filename if any. a unique filename otherwise.
  355.  
  356.     char encode[128]; // future use - to be used for encoding outgoing MIME
  357.                       // messages.
  358.  
  359.     struct MIMEContentType *next;    // pointer to next instance.
  360.     };
  361.  
  362. #endif
  363.